from xtplib import TraderApi


class XTPBroker(TraderApi):
    def __init__(self, parent):
        super(XTPBroker, self).__init__()
        self.parent = parent

    def onDisconnected(self, session_id, reason):
        self.parent.on_disconnected(session_id, reason)

    def onError(self, error_info):
        self.parent.on_error(error_info)

    def onQueryAccountTradeMarket(self, trade_location, error_info, request_id, session_id):
        self.parent.on_query_account_trade_market(trade_location, error_info, request_id, session_id)

    def onOrderEvent(self, order_info, error_info, session_id):
        self.parent.on_order_event(order_info, error_info, session_id)

    def onTradeEvent(self, trade_info, session_id):
        self.parent.on_trade_event(trade_info, session_id)

    def onCancelOrderError(self, cancel_info, error_info, session_id):
        self.parent.on_cancel_order_error(cancel_info, error_info, session_id)

    def onQueryOrder(self, order_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_order(order_info, error_info, request_id, is_last, session_id)

    def onQueryOrderEx(self, order_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_order_ex(order_info, error_info, request_id, is_last, session_id)

    def onQueryOrderByPage(self, order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id):
        self.parent.on_query_order_by_page(order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id)

    def onQueryOrderByPageEx(self, order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id):
        self.parent.on_query_order_by_page_ex(order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id)

    def onQueryTrade(self, trade_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_trade(trade_info, error_info, request_id, is_last, session_id)

    def onQueryTradeByPage(self, trade_info, req_count, order_sequence, query_reference, request_id, is_last, session_id):
        self.parent.on_query_trade_by_page(trade_info, req_count, order_sequence, query_reference, request_id, is_last, session_id)

    def onQueryPosition(self, position_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_position(position_info, error_info, request_id, is_last, session_id)

    def onQueryAsset(self, asset_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_asset(asset_info, error_info, request_id, is_last, session_id)

    def onQueryStructuredFund(self, fund_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_structured_fund(fund_info, error_info, request_id, is_last, session_id)

    def onQueryFundTransfer(self, fund_transfer_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_fund_transfer(fund_transfer_info, error_info, request_id, is_last, session_id)

    def onFundTransfer(self, fund_transfer_info, error_info, request_id, session_id):
        self.parent.on_fund_transfer(fund_transfer_info, error_info, request_id, session_id)

    def onQueryETF(self, etf_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_etf(etf_info, error_info, request_id, is_last, session_id)

    def onQueryETFBasket(self, etf_component_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_etf_basket(etf_component_info, error_info, request_id, is_last, session_id)

    def onQueryIPOInfoList(self, ipo_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_ipo_info_list(ipo_info, error_info, request_id, is_last, session_id)

    def onQueryIPOQuotaInfo(self, quota_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_ipo_quota_info(quota_info, error_info, request_id, is_last, session_id)

    def onQueryBondIPOInfoList(self, ipo_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_bond_ipo_info_list(ipo_info, error_info, request_id, is_last, session_id)

    def onQueryBondSwapStockInfo(self, swap_stock_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_bond_swap_stock_info(swap_stock_info, error_info, request_id, is_last, session_id)

    def onQueryOptionAuctionInfo(self, option_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_auction_info(option_info, error_info, request_id, is_last, session_id)

    def onCreditCashRepay(self, cash_repay_info, error_info, session_id):
        self.parent.on_credit_cash_repay(cash_repay_info, error_info, session_id)

    def onCreditCashRepayDebtInterestFee(self, cash_repay_info, error_info, session_id):
        self.parent.on_credit_cash_repay_debt_interest_fee(cash_repay_info, error_info, session_id)

    def onQueryCreditCashRepayInfo(self, cash_repay_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_credit_cash_repay_info(cash_repay_info, error_info, request_id, is_last, session_id)

    def onQueryCreditFundInfo(self, fund_info, error_info, request_id, session_id):
        self.parent.on_query_credit_fund_info(fund_info, error_info, request_id, session_id)

    def onQueryCreditDebtInfo(self, debt_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_credit_debt_info(debt_info, error_info, request_id, is_last, session_id)

    def onQueryCreditTickerDebtInfo(self, debt_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_credit_ticker_debt_info(debt_info, error_info, request_id, is_last, session_id)

    def onQueryCreditAssetDebtInfo(self, remain_amount, error_info, request_id, session_id):
        self.parent.on_query_credit_asset_debt_info(remain_amount, error_info, request_id, session_id)

    def onQueryCreditTickerAssignInfo(self, assign_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_credit_ticker_assign_info(assign_info, error_info, request_id, is_last, session_id)

    def onQueryCreditExcessStock(self, stock_info, error_info, request_id, session_id):
        self.parent.on_query_credit_excess_stock(stock_info, error_info, request_id, session_id)

    def onQueryMulCreditExcessStock(self, stock_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_mul_credit_excess_stock(stock_info, error_info, request_id, is_last, session_id)

    def onCreditExtendDebtDate(self, debt_extend_info, error_info, session_id):
        self.parent.on_credit_extend_debt_date(debt_extend_info, error_info, session_id)

    def onQueryCreditExtendDebtDateOrders(self, debt_extend_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_credit_extend_debt_date_orders(debt_extend_info, error_info, request_id, is_last, session_id)

    def onQueryCreditFundExtraInfo(self, fund_info, error_info, request_id, session_id):
        self.parent.on_query_credit_fund_extra_info(fund_info, error_info, request_id, session_id)

    def onQueryCreditPositionExtraInfo(self, fund_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_credit_position_extra_info(fund_info, error_info, request_id, is_last, session_id)

    def onOptionCombinedOrderEvent(self, order_info, error_info, request_id, is_last, session_id):
        self.parent.on_option_combined_order_event(order_info, error_info, request_id, is_last, session_id)

    def onOptionCombinedTradeEvent(self, trade_info, session_id):
        self.parent.on_option_combined_trade_event(trade_info, session_id)

    def onCancelOptionCombinedOrderError(self, cancel_info, error_info, session_id):
        self.parent.on_cancel_option_combined_order_error(cancel_info, error_info, session_id)

    def onQueryOptionCombinedOrders(self, order_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_combined_orders(order_info, error_info, request_id, is_last, session_id)

    def onQueryOptionCombinedOrdersEx(self, order_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_combined_orders_ex(order_info, error_info, request_id, is_last, session_id)

    def onQueryOptionCombinedOrdersByPage(self, order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id):
        self.parent.on_query_option_combined_orders_by_page(order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id)

    def onQueryOptionCombinedOrdersByPageEx(self, order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id):
        self.parent.on_query_option_combined_orders_by_page_ex(order_info, req_count, order_sequence, query_reference, request_id, is_last, session_id)

    def onQueryOptionCombinedTrades(self, trade_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_combined_trades(trade_info, error_info, request_id, is_last, session_id)

    def onQueryOptionCombinedTradesByPage(self, trade_info, req_count, trade_sequence, query_reference, request_id, is_last, session_id):
        self.parent.on_query_option_combined_trades_by_page(trade_info, req_count, trade_sequence, query_reference, request_id, is_last, session_id)

    def onQueryOptionCombinedPosition(self, position_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_combined_position(position_info, error_info, request_id, is_last, session_id)

    def onQueryOptionCombinedStrategyInfo(self, strategy_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_combined_strategy_info(strategy_info, error_info, request_id, is_last, session_id)

    def onQueryOptionCombinedExecPosition(self, position_info, error_info, request_id, is_last, session_id):
        self.parent.on_query_option_combined_exec_position(position_info, error_info, request_id, is_last, session_id)

    def onQueryOtherServerFund(self, fund_info, error_info, request_id, session_id):
        self.parent.on_query_other_server_fund(fund_info, error_info, request_id, session_id)

    def onQueryStrategy(self, strategy_info, strategy_param, error_info, request_id, is_last, session_id):
        self.parent.on_query_strategy(strategy_info, strategy_param, error_info, request_id, is_last, session_id)

    def onStrategyStateReport(self, strategy_state, session_id):
        self.parent.on_strategy_state_report(strategy_state, session_id)

    def onALGOUserEstablishChannel(self, user, error_info, session_id):
        self.parent.on_algo_user_establish_channel(user, error_info, session_id)

    def onInsertAlgoOrder(self, strategy_info, error_info, session_id):
        self.parent.on_insert_algo_order(strategy_info, error_info, session_id)

    def onCancelAlgoOrder(self, strategy_info, error_info, session_id):
        self.parent.on_cancel_algo_order(strategy_info, error_info, session_id)

    def onAlgoDisconnected(self, reason):
        self.parent.on_algo_disconnected(reason)

    def onAlgoConnected(self):
        self.parent.on_algo_connected()

    def onStrategySymbolStateReport(self, strategy_symbol_state, session_id):
        self.parent.on_strategy_symbol_state_report(strategy_symbol_state, session_id)

    def onNewStrategyCreateReport(self, strategy_info, strategy_param, session_id):
        self.parent.on_new_strategy_create_report(strategy_info, strategy_param, session_id)

    def onStrategyRecommendation(self, basket_flag, recommendation_info, strategy_param, error_info, request_id, is_last, session_id):
        self.parent.on_strategy_recommendation(basket_flag, recommendation_info, strategy_param, error_info, request_id, is_last, session_id)

    def onModifyAlgoOrder(self, data, error, session_id):
        self.parent.on_modify_algo_order(data, error, session_id)

    def onPauseAlgoOrder(self, xtp_strategy_id, ticker_info, error_info, request_id, session_id):
        self.parent.on_pause_algo_order(xtp_strategy_id, ticker_info, error_info, request_id, session_id)

    def onResumeAlgoOrder(self, xtp_strategy_id, ticker_info, error_info, request_id, session_id):
        self.parent.on_resume_algo_order(xtp_strategy_id, ticker_info, error_info, request_id, session_id)
